package com.youmeek.demo.web.servlet.Test;

public class SingletonPattern {

    /**
     * 第一种
     */


    private static final SingletonPattern SINGLETON_PATTERN = new SingletonPattern();
    private SingletonPattern(){ }
    public static SingletonPattern getSingletonPattern() { return SINGLETON_PATTERN; }

    /**
     * 第二种
     */

   /* private SingletonPattern(){ }
    private static volatile SingletonPattern SINGLETON_PATTERN;
    public static SingletonPattern getSingletonPattern() { if (SINGLETON_PATTERN != null){ if (synchronized(SingletonPattern.class)){ return SINGLETON_PATTERN = new SingletonPattern(); } } }*/


    /**
     * 第三种
     */
    /*private SingletonPattern(){ }
    private static SingletonPattern singletonPattern;
    private class staticSingletonPattern{
        private staticSingletonPattern staticSingletonPattern;
        public SingletonPattern getSingletonPattern(){
           return staticSingletonPattern = SingletonPattern.singletonPattern
        }
    }*/


}
